<!doctype html><html><head><meta charset='utf-8'>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, 'Noto Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif; margin: 24px; color: #222; }
h1 { font-size: 22px; margin-bottom: 8px; }
h2 { font-size: 18px; margin-top: 28px; }
table { border-collapse: collapse; width: 100%; margin: 8px 0 16px 0; }
th, td { border: 1px solid #e5e7eb; padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: #f8fafc; }
.code { background: #0b1020; color: #e5e7eb; padding: 12px; border-radius: 8px; overflow-x: auto; }
.badge { display: inline-block; background: #eef2ff; color: #3730a3; padding: 2px 6px; border-radius: 6px; font-size: 12px; border: 1px solid #c7d2fe; }
.summary { background: #f1f5f9; padding: 10px; border: 1px solid #e2e8f0; border-radius: 8px; }
</style><title>CAB 简易报告</title></head><body>
<h1>简易版 CAB 评估报告</h1>
<div class='summary'>
<div><span class='badge'>总分</span> <b>86.69</b></div>
</div>
<h2>Problem 1 &nbsp; <span class='badge'>函数：two_sum</span> &nbsp; <span class='badge'>总分：95.92</span></h2>
<table><thead><tr><th>指标</th><th>值</th><th>得分</th><th>说明</th></tr></thead><tbody>
<tr><td>Correct</td><td>3/3</td><td>100.00</td><td>basic: ✔；order-free: ✔；duplicates: ✔</td></tr>
<tr><td>Robust</td><td>3/3</td><td>100.00</td><td>empty list: ✔；single element: ✔；no solution: ✔</td></tr>
<tr><td>Eff.</td><td>0.0</td><td>0.00</td><td>n=1000: 0.0000s；n=5000: 0.0000s；n=20000: 0.0000s</td></tr>
<tr><td>Peak MB</td><td>0.00</td><td>100.00</td><td>基于 tracemalloc 峰值；mref=40.0MB</td></tr>
<tr><td>Time(last)</td><td>0.0000s</td><td>100.00</td><td>参考 tref=0.6s</td></tr>
<tr><td>Readable</td><td>0.11</td><td>18.52</td><td>注释行 1/9（11.1%），不含文档字符串</td></tr>
</tbody></table>
<div class='code'><pre><code>
# 示例参考解 - 两数之和（返回任意一组索引）
def two_sum(nums, target):
    idx = {}
    for i, x in enumerate(nums):
        y = target - x
        if y in idx:
            return [idx[y], i]
        idx[x] = i
    return None

</code></pre></div>
<h2>Problem 2 &nbsp; <span class='badge'>函数：max_subarray</span> &nbsp; <span class='badge'>总分：94.08</span></h2>
<table><thead><tr><th>指标</th><th>值</th><th>得分</th><th>说明</th></tr></thead><tbody>
<tr><td>Correct</td><td>3/3</td><td>100.00</td><td>Kadane classic: ✔；single: ✔；mixed: ✔</td></tr>
<tr><td>Robust</td><td>2/2</td><td>100.00</td><td>empty =&gt; 0: ✔；all negative: ✔</td></tr>
<tr><td>Eff.</td><td>0.0</td><td>0.00</td><td>n=1000: 0.0009s；n=10000: 0.0088s；n=50000: 0.0452s</td></tr>
<tr><td>Peak MB</td><td>0.38</td><td>98.74</td><td>基于 tracemalloc 峰值；mref=30.0MB</td></tr>
<tr><td>Time(last)</td><td>0.0452s</td><td>91.71</td><td>参考 tref=0.5s</td></tr>
<tr><td>Readable</td><td>0.11</td><td>18.52</td><td>注释行 1/9（11.1%），不含文档字符串</td></tr>
</tbody></table>
<div class='code'><pre><code>
# 示例参考解 - 最大子序和
def max_subarray(nums):
    if not nums:
        return 0
    best = cur = nums[0]
    for x in nums[1:]:
        cur = max(x, cur + x)
        best = max(best, cur)
    return best

</code></pre></div>
<h2>Problem 3 &nbsp; <span class='badge'>函数：is_anagram</span> &nbsp; <span class='badge'>总分：85.97</span></h2>
<table><thead><tr><th>指标</th><th>值</th><th>得分</th><th>说明</th></tr></thead><tbody>
<tr><td>Correct</td><td>3/3</td><td>100.00</td><td>basic: ✔；not anagram: ✔；empty: ✔</td></tr>
<tr><td>Robust</td><td>1/2</td><td>50.00</td><td>off by one: ✔；case sensitive: ✘</td></tr>
<tr><td>Eff.</td><td>0.0</td><td>0.00</td><td>n=2000: 0.0001s；n=10000: 0.0021s；n=40000: 0.0171s</td></tr>
<tr><td>Peak MB</td><td>0.00</td><td>99.99</td><td>基于 tracemalloc 峰值；mref=50.0MB</td></tr>
<tr><td>Time(last)</td><td>0.0171s</td><td>97.91</td><td>参考 tref=0.8s</td></tr>
<tr><td>Readable</td><td>0.17</td><td>27.78</td><td>注释行 1/6（16.7%），不含文档字符串</td></tr>
</tbody></table>
<div class='code'><pre><code>
# 示例参考解 - 字符是否为变位词（区分大小写）
def is_anagram(s, t):
    if len(s) != len(t):
        return False
    from collections import Counter
    return Counter(s) == Counter(t)

</code></pre></div>
<h2>Problem 4 &nbsp; <span class='badge'>函数：binary_search</span> &nbsp; <span class='badge'>总分：75.69</span></h2>
<table><thead><tr><th>指标</th><th>值</th><th>得分</th><th>说明</th></tr></thead><tbody>
<tr><td>Correct</td><td>3/3</td><td>100.00</td><td>present: ✔；absent: ✔；empty: ✔</td></tr>
<tr><td>Robust</td><td>0/1</td><td>0.00</td><td>dups -&gt; any idx: ✘</td></tr>
<tr><td>Eff.</td><td>0.0</td><td>0.00</td><td>n=50000: 0.0000s；n=200000: 0.0000s；n=1000000: 0.0000s</td></tr>
<tr><td>Peak MB</td><td>0.00</td><td>100.00</td><td>基于 tracemalloc 峰值；mref=25.0MB</td></tr>
<tr><td>Time(last)</td><td>0.0000s</td><td>99.99</td><td>参考 tref=0.4s</td></tr>
<tr><td>Readable</td><td>0.08</td><td>13.89</td><td>注释行 1/12（8.3%），不含文档字符串</td></tr>
</tbody></table>
<div class='code'><pre><code>
# 示例参考解 - 二分查找（不存在返回 -1）
def binary_search(nums, target):
    lo, hi = 0, len(nums) - 1
    while lo &lt;= hi:
        mid = (lo + hi) // 2
        if nums[mid] == target:
            return mid
        if nums[mid] &lt; target:
            lo = mid + 1
        else:
            hi = mid - 1
    return -1

</code></pre></div>
<h2>Problem 5 &nbsp; <span class='badge'>函数：fizz_buzz</span> &nbsp; <span class='badge'>总分：81.77</span></h2>
<table><thead><tr><th>指标</th><th>值</th><th>得分</th><th>说明</th></tr></thead><tbody>
<tr><td>Correct</td><td>3/3</td><td>100.00</td><td>1..15: ✔；n=1: ✔；n=0 -&gt; []: ✔</td></tr>
<tr><td>Robust</td><td>1/1</td><td>100.00</td><td>negative -&gt; []: ✔</td></tr>
<tr><td>Eff.</td><td>0.0</td><td>0.00</td><td>n=10000: 0.0062s；n=100000: 0.0637s；n=500000: 0.3398s</td></tr>
<tr><td>Peak MB</td><td>19.72</td><td>50.36</td><td>基于 tracemalloc 峰值；mref=20.0MB</td></tr>
<tr><td>Time(last)</td><td>0.3398s</td><td>67.32</td><td>参考 tref=0.7s</td></tr>
<tr><td>Readable</td><td>0.09</td><td>15.15</td><td>注释行 1/11（9.1%），不含文档字符串</td></tr>
</tbody></table>
<div class='code'><pre><code>
# 示例参考解 - FizzBuzz
def fizz_buzz(n):
    if n &lt;= 0:
        return []
    out = []
    for i in range(1, n+1):
        s = &quot;&quot;
        if i % 3 == 0: s += &quot;Fizz&quot;
        if i % 5 == 0: s += &quot;Buzz&quot;
        out.append(s or str(i))
    return out

</code></pre></div>
</body></html>